<template>
    <el-header>
        <el-row>
            <el-col :span="12">
                <div class="grid-content bg-purple">
                    <img src="@/static/img/logo.png" alt="">
                </div>
            </el-col>
            <el-col :span="12" >
                <div class="grid-content bg-purple-light">
                    欢迎你，{{ $store.state.userData.userName }}
                    <el-link type="primary" @click="logout">退出</el-link>
                </div>
            </el-col>
        </el-row>
    </el-header>
</template>

<script>
    export default {
        name: "Header",
        created() {
            this.$store.dispatch('getUser')
        },
        methods: {
            logout() {
                this.utils.setCookie('USER_TOKEN', '', -1);
                this.$router.replace('/')
            }
        }
    }
</script>
